package jp.sinya.refreshframework.simple.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import jp.sinya.refreshframework.R;

public class TestCommonAdapter extends BaseAdapter {
    List<String> items;
    Context context;

    public TestCommonAdapter(Context context, List<String> items) {
        this.context = context;
        this.items = items;
    }

    @Override
    public int getCount() {
        return items.size();
    }

    @Override
    public Object getItem(int position) {
        return items.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(context).inflate(R.layout.simple_listview_item, null);
        TextView tv = (TextView) view.findViewById(R.id.tv);
        tv.setText(items.get(position));
        return view;
    }

}
